<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Spaz</title>

<script type="text/javascript" src="assets/AIRAliases.js"></script>

<script src="assets/spaz.file.js"   type="text/javascript"></script>
<script src="assets/spaz.debug.js"  type="text/javascript"></script>
<script src="assets/spaz.info.js"   type="text/javascript"></script>
<script src="assets/spaz.prefs.js"  type="text/javascript"></script>
<script src="assets/spaz.update.js" type="text/javascript"></script>
<script src="assets/spaz.bridge.js" type="text/javascript"></script>
<script src="assets/spaz.menus.js" type="text/javascript" charset="utf-8"></script>
<script src="assets/spaz.notify.js" type="text/javascript" charset="utf-8"></script>
<script src="lib/library.swf" type="application/x-shockwave-flash"></script>
	

<!-- Firebug lite -->
<script language="javascript" type="text/javascript" src="assets/firebug/firebug.js"></script>



</head>

<body onload="rootInit()">
	<iframe style="width:100%;height:100%;top:0px;left:0px;position:absolute;border:none;"
		src="index.html" sandboxRoot="https://fakedomain.air/" documentRoot="app-resource:/"
		onload="Spaz.Bridge.$init(this)"></iframe>
</body>
</html>
<script>

// function notify() {
// 	air.trace("init notifier");
// 	var notifier = new runtime.com.adobe.air.notification.Purr(5);
// 	air.trace('notifier init-ed')
// 
// 	var title = "This is a title";
// 	var message = "This is a message";
// 	var where = runtime.com.adobe.air.notification.AbstractNotification.BOTTOM_RIGHT;
// 	notifier.addTextNotificationByParams(title, message, where, 5, null);
// }





function rootInit() {
	
	
	window.htmlControl.manageCookies = false;
	window.htmlControl.paintsDefaultBackground = false;
	window.htmlControl.shouldCacheResponse = false;
	window.htmlControl.useCache = false;
	
	if (Spaz.Prefs.handleHTTPAuth) {
		Spaz.dump('Turning ON HTTPAuth handling')
		window.htmlControl.shouldAuthenticate = true;
	} else {
		Spaz.dump('Turning OFF HTTPAuth handling')
		window.htmlControl.shouldAuthenticate = false;
	}
	
	
	// apply dropshadow to window
	Spaz.dump('Applying Flash Filter Dropshadow');
	window.htmlControl.filters = window.runtime.Array(
		new window.runtime.flash.filters.DropShadowFilter(3,90,0,.8,6,6)
	);


	if (Spaz.Prefs.showNativeMenus) {
		Spaz.dump('Initializing NativeMenus')
		Spaz.Menus.initAll();
	}
	
	// 
	// myListener = new Object();
	// 
	// myListener.onKeyDown = function (event) {
	// 	//alert ("You pressed a key.");
	// 	air.trace(event.toString());
	// }
	// myListener.onKeyUp = function (event) {
	// 	//alert ("You released a key.");
	// }
	
	// if (Spaz.Prefs.minimizeOnDeactivate) {
	// 	air.Shell.shell.addEventListener('deactivate', function() {
	// 		window.nativeWindow.minimize();
	// 	})
	// }
	// 
	// if (Spaz.Prefs.restoreOnActivate) {
	// 	air.Shell.shell.addEventListener('activate', function() {
	// 		window.nativeWindow.restore();
	// 	})
	// }
	
	// air.Shell.shell.idleThreshold = 10;
	// Spaz.dump('idle time:'+air.Shell.shell.idleThreshold);
	// 
	// air.Shell.shell.addEventListener(window.runtime.flash.events.Event.USER_IDLE, function(event) {
	// 	Spaz.dump('user has gone idle');
	// })
	// air.Shell.shell.addEventListener(air.Event.USER_PRESENT, function(event) {
	// 	Spaz.dump('user has returned');
	// })
	

	var memoryTimer = new air.Timer(1000*10, 0);
	memoryTimer.addEventListener(air.TimerEvent.TIMER, function(event){
		Spaz.dump('air.System.totalMemory = '+air.System.totalMemory);
	});
	memoryTimer.start();
	
}

</script>